<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>图片预览</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="./../../../favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="./../../../static/css/font.css">
    <style>
        html, body {
            width: 100%;
            height: 100%;
            margin: 0;
            overflow: hidden;
        }

        img {
            max-width: 300px;
            max-height: 200px;
            display: none;
        }
    </style>
</head>
<body>
<div class="content" id="view">
    <div class="gallerys">
        <img class="gallery-pic" src="" style="" id="img1"/>
    </div>
</div>
<script src="jquery-photo-gallery/jquery.js"></script>
<script src="jquery-photo-gallery/jquery.photo.gallery.js"></script>
<script>
    $(function () {
        var imgTypeArr = [
            '.jpg',
            '.png'
        ];
        var href = localStorage.imageHref;
        var type = localStorage.imageType;
        if ($.inArray(type, imgTypeArr) == '-1') {
            location.href = href;
        } else {
            $('img').attr('src', href);
            var img1 = document.getElementById('img1');
            imgLoad(img1, function (img) {
                //图片加载完毕
                $.openPhotoGallery(img);
            });
        }
    });

    // 判断图片加载完毕
    function imgLoad(img, callback) {
        var timer = setInterval(function () {
            if (img.complete) {
                clearInterval(timer);
                return callback && callback(img)
            }
        }, 50)
    }
</script>
</body>
</html>